<template>
  <div class="user">
    <header>
      <span class="lf"></span>
      <Drag v-if="imglist" :imglist="imglist" />
      <span class="rt"></span>
    </header>
    <Userform v-if="user" :user="user"/>
    <p class="status" :class="{none:!auditing}"><icon type="warn"></icon><span v-if="0==auditStatus">内容未通过审核，请重新提交</span><span v-if="1==auditStatus">内容已通过审核</span><span v-if="2==auditStatus">内容审核中</span></p>
    <p class="status" :class="{none:auditing}"></p>
    <p  class="btn"><span @click.passive="toRank"></span><span v-show="1==auditStatus||2==auditStatus" @click.passive="toRuler"></span><span v-show="0==auditStatus"  @click.passive="rebackFill"></span></p>
  </div>
</template>
<script>
import Drag from '@/components/com/Drag';
import Userform from '@/components/com/Userform';
import Impress from '@/components/com/Impress';
import Qs from 'qs'
import {  getServerHost,
  preventMove,
  GetRequest,
  checkMobile,
  checkQq} from '@/assets/lib/tool.js'
import { wxShare } from "@/assets/lib/wxshare.js";
import { Icon } from 'vux'
export default {
  components: { Drag, Userform, Impress, Icon },
  data() {
    return {
      auditing: true,
      queryInfoMyselfUrl: '/wxjx/goddess/common/user/queryInfoMyself',
      openid: GetRequest().openid,
      user: {
      },
      imglist: [],
      // pathUrlImg: 'http://118.212.184.170/wxjx/file/img',
      pathUrlImg: '',
      auditStatus: ''

    }
  },
  mounted() {
    this.$nextTick(() => {
      this.getUserInfor();
      setTimeout(() => {
        wxShare();
      }, 500)
    })
  },
  watch: {
    user(val) {
      // console.log(val);
      return val;
    }
  },
  methods: {
    //查看排行
    toRank() {
      this.$router.push({ path: '/', query: { openid: this.openid } })
    },
    //查看规则
    toRuler() {
      this.$router.push({ path: '/ruler', query: { openid: this.openid } })
    },
    //重新提交
    rebackFill() {
      this.$router.push({ path: '/main', query: { openid: this.openid, type: 'upadate' } })
    },
    //获取用户信息
    getUserInfor() {
      var vm = this;
      this.$http.get(getServerHost() + this.queryInfoMyselfUrl, {
        params: {
          openid: this.openid
        }
      }).then(rs => {
        // console.log(rs);
        rs = rs.data;
        if ('200' == rs.code) {
          this.user = rs.res;
          this.auditStatus = rs.res.auditStatus;
          if (rs.res.image1Path) {
            vm.imglist.unshift(vm.pathUrlImg + rs.res.image1Path)
          }
          if (rs.res.image2Path) {
            vm.imglist.unshift(vm.pathUrlImg + rs.res.image2Path)
          }
          if (rs.res.image3Path) {
            vm.imglist.unshift(vm.pathUrlImg + rs.res.image3Path)
          } if (rs.res.image4Path) {
            vm.imglist.unshift(vm.pathUrlImg + rs.res.image4Path)
          }
        }

      })
    }
  },
}
</script>
<style lang="less" scoped>
.user {
  padding: 30px 0;
  width: 100%;
  min-height: 100vh;
  background: url("../../assets/img/user-bg.png") no-repeat;
  background-size: 100% 100%;
  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    .lf {
      position: relative;
      left: 80px;
      width: 39px;
      height: 58px;
      background: url("../../assets/img/lf-icon.png") no-repeat;
      background-size: 100% 100%;
    }
    .rt {
      position: relative;
      right: 80px;
      width: 39px;
      height: 58px;
      background: url("../../assets/img/rt-icon.png") no-repeat;
      background-size: 100% 100%;
    }
  }
  .rank {
    padding: 10px 0;
    display: flex;
    justify-content: space-around;
    color: #ce1010;
    font-weight: bold;
  }
  .status {
    padding: 20px 0;
    color: #ce1010;
  }
  .btn {
    padding-top: 10px;
    display: flex;
    justify-content: space-around;
    span:nth-child(1) {
      width: 245px;
      height: 76px;
      background: url("../../assets/img/auditing-btns.png") no-repeat -5px 0;
      background-size: 528px 168px;
    }
    span:nth-child(2) {
      width: 245px;
      height: 76px;
      background: url("../../assets/img/auditing-btns.png") no-repeat -275px 0;
      background-size: 528px 168px;
    }
    span:nth-child(3) {
      width: 245px;
      height: 76px;
      background: url("../../assets/img/auditing-btns.png") no-repeat 0 -82px;
      background-size: 528px 168px;
    }
  }
}
</style>
